﻿var current_image;
var play_mode = 0;
var oldIndex = 0;
function GoToImage(number) {
    play_mode = 0;
    viewPic(number);
    document.control_form.SequenceForm.value = nameSequence;
}
function animate_fwd() {
    if (play_mode == 0) { return; }
    if (current_image > last_pict) {
        current_image = 0;
        setTimeout("animate_fwd()", 1500);
    } else {
        viewPic(current_image);
        current_image++;
        setTimeout("animate_fwd()", 300);
    }
}
function viewPic(nr) {
    document.animation.src = theImages[nr].src;
    document.anchors[oldIndex].style.textDecoration = 'none';
    document.anchors[nr].style.textDecoration = 'underline';
    oldIndex = nr;
}
function startAnimation() {
    if (play_mode == 0) {
        document.control_form.SequenceForm.value = nameStop;
        play_mode = 1;
        current_image = 0;
        animate_fwd();
    } else { GoToImage(0) }
}